Database systems carry out their functions through the use of discrete transactions A transaction is a unit of work which includes an execution of an application programspecified sequence of operations that are initiated with a begin transaction operation, include one or more update and/or read access operations, and end with either a commit or backout operation. A commit operation signals successful completion of the transaction, while a backout operation denotes unsuccessful completion of the transaction due to an abnormal circumstance. The commit and backout operations are employed to ensure that transactions proceed atomically, or not at all.
In a transaction-oriented system wherein operations are executed at only one site during any transaction, transaction atomicity is enforced by a one-phase synchronization operation, known as a "single phase commit". A single phase commit operation proceeds as follows. When a transaction is completed, the DBMS requests that the site where the transaction occurred make permanent all changes to the database made during the transaction. In response, the site either commits or backs out the changes and reports the commit or backout actions to the DBMS.
In distributed database systems, a transaction may cause changes to databases at more than one site. In such a system, atomicity can be guaranteed only if all of the sites agree on its outcome. Many such systems use a transaction synchronization procedure called "two phase commit" wherein, in a first phase of the protocol, all involved database sites are requested to prepare to commit. In response, the sites individually decide whether to commit or backout their operations. Those decisions are communicated to a synchronization site where the "votes" are counted. If all sites vote to commit, a request to commit is issued to all sites, in response to which, all of the sites commit their operations. If any one site votes to back out its operation, all sites back out their operation.
A two phase commit, while enabling synchronization of multiple databases, requires more communication and processing than a single phase commit and thus is more costly in terms of system processing time. By contrast, a single phase commit is faster, requires less processing bandwidth, but is limited in its ability to assure data synchronization in a distributed database system. Nevertheless, even in a distributed database system, some data access operations are such that a single phase commit is sufficient to assure data synchronization, e.g., read-only actions which require no write actions; where only a single database site requires synchronization, etc. Accordingly, in those cases a single phase commit protocol is sufficient to assure data integrity.
For a database which can support both single phase and two phase commit protocols, it would thus be useful to enable an application program to adaptively control which type of commit protocol is used, in accordance with the particular data access action being performed. In the prior art, commit protocols have generally been set during an initialization phase between a central database site and remote database sites. Thereafter, the commit protocol has remained unchanged.
Accordingly, it is an object of this invention to provide a distributed database system with an improved ability to selectively alter commit protocols.
It is another object of this invention to provide an improved distributed database system which can transition between single phase and two phase commits, based upon the data access procedure that is executed.